#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <iomanip>

using namespace std;

int m, n;

typedef struct TPoint {
	double x, y;
} TPoint;

typedef struct TShape {
	int num;
	TPoint* points;
} TShape;

TShape p1, p2;

TPoint operator - (TPoint a, TPoint b) {
	TPoint res;
	res.x = a.x - b.x;
	res.y = a.y - b.y;
	return res;
}

ostream& operator<<(std::ostream& os, const TPoint& a) {
	return cout << a.x << " " << a.y;
}

double cross(TPoint a, TPoint b){
	return a.x*b.y - b.x*a.y;
}
double dot(TPoint a, TPoint b) {
	return a.x*b.x + a.y*b.y;
}

double calArea(TShape poly) {
	double area = 0;
	for (int i=0; i<poly.num; ++i)
		area += cross(poly.points[i+1], poly.points[i]);
	return area/2;
}

//only allow (u,b,v), (a,v,b) in a line
bool crossed(TPoint a, TPoint b, TPoint u, TPoint v, TPoint& ret, int ends=1) {
// 	cout << a << "  " << b << "  " << u << "  " << v << endl;
	double t1, t2;
	t1 = cross(b-a, u-a);
	t2 = cross(b-a, v-a);
	if (t1*t2 > 0) return false;
	t1 = cross(v-u, a-u);
	t2 = cross(v-u, b-u);
	if (t1*t2 > 0) return false;
	t1 = fabs(cross(u-a, v-a));
	if (ends==1 && t1 < 0.0001) return false;
	t2 = fabs(cross(a-u, b-u));
	if (ends==1 && t2 < 0.0001) return false;
	t2 = fabs(cross(u-b, v-b));

	if (ends == 1) {
		ret.x = a.x+ t1/(t2+t1)*(b.x - a.x);
		ret.y = a.y+ t1/(t2+t1)*(b.y - a.y);
	}
	return true;
}

int crossed(TPoint a, TPoint b, TShape poly, int ends=1) {
	int c = 0;
	TPoint ret;
	for (int i=0; i<poly.num; ++i)
		if (crossed(a, b, poly.points[i], poly.points[i+1], ret, ends)) {
// 			cout << "cross at " << i << endl;
			++c;
		}
	return c;
}

bool inShape(TPoint a, TShape poly) {
	TPoint na, nb;
	na.x = a.x;
	na.y = a.y;
	nb.x = 101;
	nb.y = na.y;
	int c = crossed(na, nb, poly, 2);
	return c%2 == 1;
}

double norm(TPoint a) {return (a.x*a.x + a.y*a.y);}

int findWhich(TPoint a, TPoint b, TShape poly, TPoint& ret) {
	TPoint inter[10];
	int interNum = 0, idx[10];
	for (int i=0; i<poly.num; ++i) {
		if (crossed(a, b, poly.points[i], poly.points[i+1], inter[interNum])) {
			idx[interNum] = (i+1)%poly.num;
			++interNum;
		}
	}
	int choose = 0;
	double minL = 10000;
	for (int i=0; i<interNum; ++i) {
		double l1 = norm(inter[i] - a);
		if (l1 < minL) {
			minL = l1;
			choose = i;
		}
	}
	ret = inter[choose];
	return idx[choose];
}

TShape calIntersected(TShape p1, TShape p2) {
	vector<TPoint> newPoints;
	int start = -1;

	//try to find a point of p1 not in p2
	for (int i=0; i<p1.num; ++i) {
		if (!inShape(p1.points[i], p2)) {
			start = i;
			break;
		}
	}

	if (start == -1) {
		swap(p1, p2);
		for (int i=0; i<p1.num; ++i) {
			if (!inShape(p1.points[i], p2)) {
				start = i;
				break;
			}
		}
	}

// 	cout << start << endl;

	newPoints.push_back(p1.points[start]);
	int iter1 = start, iter2=0;
	bool isRunOne = true;
	do {
		cout << "iter1: " << iter1 << " iter2: " << iter2 << endl;
		if (isRunOne) {
			if (crossed(p1.points[iter1], p1.points[iter1+1], p2) > 0) {
// 				cout << "run one crossed!" << endl;
				TPoint interPoint;
				iter2 = findWhich(p1.points[iter1], p1.points[iter1+1], p2, interPoint);
				isRunOne = false;
				newPoints.push_back(interPoint);
				newPoints.push_back(p2.points[iter2]);
				iter1 = (iter1+1)%p1.num;
			}
			else {
				iter1 = (iter1+1)%p1.num;
				newPoints.push_back(p1.points[iter1]);
			}
		}
		else {
			if (crossed(p2.points[iter2], p2.points[iter2+1], p1) > 0) {
// 				cout << "run two crossed!" << endl;
				TPoint interPoint;
				iter1 = findWhich(p2.points[iter2], p2.points[iter2+1], p1, interPoint);
				isRunOne = true;
				newPoints.push_back(interPoint);
				newPoints.push_back(p1.points[iter1]);
				iter2 = (iter2+1)%p2.num;
			}
			else {
				iter2 = (iter2+1)%p2.num;
				newPoints.push_back(p2.points[iter2]);
			}
		}
	} while (iter1 != start);

	TShape res;
	res.num = newPoints.size()-1;
	res.points = new TPoint[res.num+1];
	for (int i=0; i<newPoints.size(); ++i)
		res.points[i] = newPoints[i];
	return res;
}

int main(void)
{
	freopen("input.txt", "r", stdin);
	p1.num = p2.num = 0;
	p1.points = p2.points = 0;
	while (true){
		cin >> m;
		if (m == 0) break;
		p1.num = m;
		p1.points = new TPoint[m+1];
		for (int i=0; i<m; ++i)
			cin >> p1.points[i].x >> p1.points[i].y;
		p1.points[m] = p1.points[0];
		cin >> n;
		p2.num = n;
		p2.points = new TPoint[n+1];
		for (int i=0; i<n; ++i)
			cin >> p2.points[i].x >> p2.points[i].y;
		p2.points[n] = p2.points[0];

// 		cout << "p1 area: " << calArea(p1) << endl;
// 		cout << "p2 area: " << calArea(p2) << endl;

		TShape itsctShape = calIntersected(p1, p2);
// 		cout << intersected.num << endl;
// 		for (int i=0; i<intersected.num; ++i)
// 			cout << intersected.points[i] << endl;
		double itsctShapeArea = calArea(itsctShape);

		double intersectArea = calArea(p1) + calArea(p2) - itsctShapeArea;
		cout << setprecision(2) << setiosflags(ios::fixed) << setw(8)
				<< itsctShapeArea - intersectArea;

		delete[] p1.points;
		delete[] p2.points;
		p1.num = p2.num = 0;
		p1.points = p2.points = 0;
	}

	return 0;
}